// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   LimitDocument.java

package com.boci.common.ui.control;

import java.awt.Toolkit;
import javax.swing.text.*;

public class LimitDocument extends PlainDocument
{

    public LimitDocument(int pMaxChar)
    {
        intMaxChar = pMaxChar;
    }

    public void insertString(int offs, String str, AttributeSet a)
        throws BadLocationException
    {
        StringBuffer buffer = new StringBuffer(getText(0, getLength()));
        if(buffer.length() + str.length() <= intMaxChar)
            super.insertString(offs, str, a);
        else
            Toolkit.getDefaultToolkit().beep();
    }

    int intMaxChar;
}
